<template>
    <div class="app-container">
            <el-page-header @back="goBack" title="返回" style="font-size:20px ; font-weight: bold" content="商品详情"></el-page-header>
        <el-divider></el-divider>
        <el-form ref="form" :model="form" label-width="80px" style="width:80%">
            <el-row>
                <el-col>
                    <el-form-item label="所属主题">
                        <el-input v-model="form.goodsName" style="width:40%"/>
                    </el-form-item>

                    <el-form-item label="商品名称">
                        <el-input v-model="form.goodsName" style="width:40%"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>


            <el-form-item label="商品编号">
                <el-input v-model="form.goodsCode" style="width:40%"></el-input>
            </el-form-item>
            <el-form-item label="销售价格(单件￥)">
                <el-input v-model="form.price" style="width:40%"></el-input>
            </el-form-item>
            <el-form-item label="成本价格(单件￥)">
                <el-input v-model="form.costPrice" style="width:40%"></el-input>
            </el-form-item>
            <el-form-item label="利润价格(单件￥)">
                <el-input v-model="form.profitPrice" style="width:40%"></el-input>
            </el-form-item>
            <el-form-item label="库存">
                <el-input v-model="form.num" style="width:40%"></el-input>
            </el-form-item>
            <el-form-item label="备注">
                <el-input type="textarea" v-model="form.goodsRemark" style="width:60%"> </el-input>
            </el-form-item>
            <el-form-item label="商品图">
              预览地址
            </el-form-item>
        </el-form>
    </div>

</template>

<script>

    import request from "../../utils/request";

    export default {
        name: "GoodsDetail",
        data(){
            return {
                form:{}
            }
        },
        created(){
            this.goodsDetailInfo()
        },
        methods: {
            goBack(){
                this.$router.push('/goodsManager')
            },
            goodsDetailInfo(){
               // 取到路由带过来的参数
               const routerParams = this.$route.query.id;
               // 将数据放在当前组件的数据内
               //this.mallInfo.searchMap.mallCode = routerParams;
               //this.keyupMallName()
                request.get("/api/goods/getGoodsDetail",{
                    params:{
                        id:routerParams
                    }
                }).then(resp=>{
                    if(resp.status=='M0200'){
                        this.form=resp.data
                    }
                })
            },
            watch: {
                '$route': 'goodsDetailInfo'
            }
        }
    }
</script>

<style scoped>

</style>
